
#include "../src/configuration.hpp"
#include "../src/log.hpp"
#include "../src/tasks.hpp"

#include <boost/test/included/unit_test.hpp>
using namespace boost::unit_test;

#include <iostream>

void testCreatePerfRunPlan();

void testCreatePerfRunPlanWith2Substitutions();

void testCreateEmptyPerfRunPlan();

void testShouldThrowIfReferenceToUnExistingMessageTemplate();

void testPerfRunFileDao();

/*
class A {
public:
	virtual ~A() {
		std::cout << "A::~A()" << std::endl;
	}
	virtual void doIt() {
		std::cout << "A::doIt()" << std::endl;
	}
};

class B: public A {
public:
	virtual ~B() {
		std::cout << "B::~B()" << std::endl;
	}
	virtual void doIt() {
		std::cout << "B::doIt()" << std::endl;
	}
};

void
doIt(A& a) {
	a.doIt();
}

void testDoIt() {
	A a;
	B b;
	doIt(a);
	doIt(b);
}
*/

class F10 {
public:
	F10(int value): value_(value) {};

	operator bool() {
		std::cout << "F10::bool()" << std::endl;
		return value_ == 10;
	}

private:
	int value_;
};

void testF10() {
	using namespace std;
	using namespace fixstoker;

	LOG_DEBUG("LOG_DEBUG test" << " it is working!!!");
	LOG_INFO("LOG_INFO test");

	cout << "testF10()" << endl;

	F10 f10(10);
	if (f10) {
		cout << "f10 == true" << endl;
	} else {
		cout << "f10 == false" << endl;
	}

	F10 f1(1);
	if (f1) {
		cout << "f1 == true" << endl;
	} else {
		cout << "f1 == false" << endl;
	}
}

void testRunAllTasks() {
	fixstoker::run_all_tasks();
}

test_suite*
init_unit_test_suite(int argc, char* argv[]) {
	fixstoker::configure(0, 0);
	framework::master_test_suite().add(BOOST_TEST_CASE( &testCreatePerfRunPlan ));
	framework::master_test_suite().add(BOOST_TEST_CASE( &testCreatePerfRunPlanWith2Substitutions ));
	framework::master_test_suite().add(BOOST_TEST_CASE( &testCreateEmptyPerfRunPlan ));
	framework::master_test_suite().add(BOOST_TEST_CASE( &testShouldThrowIfReferenceToUnExistingMessageTemplate ));
	framework::master_test_suite().add(BOOST_TEST_CASE( &testPerfRunFileDao));
//	framework::master_test_suite().add(BOOST_TEST_CASE( &testDoIt));
//	framework::master_test_suite().add(BOOST_TEST_CASE( &testF10 ));
	framework::master_test_suite().add(BOOST_TEST_CASE( &testRunAllTasks ));

	return 0;
}
